//
//  MyUIButton.swift
//  foreign_swift
//
//  Created by 黄敦仁 on 15/5/4.
//  Copyright (c) 2015年 hdr. All rights reserved.
//

import UIKit

class ServiceButton:UIButton {
    init(){
        super.init(frame: CGRectZero)
    }

    required init(coder aDecoder: NSCoder) {
        fatalError("init(coder:) has not been implemented")
    }
    
    override func layoutSubviews() {
        super.layoutSubviews()
        
        if let img = self.imageView ,label = self.titleLabel{
            img.center = CGPoint(x: self.width/2, y:  (self.height - label.height)/2)
            label.frame = CGRect(x: 0, y: self.height - label.height-5, width: self.width, height: label.height)
            label.textAlignment = NSTextAlignment.Center
        }
    }
}
